/*
 * @Description:
 * @Version: 2.0
 * @Autor: zhaoyu
 * @Date: 2021-04-16 14:03:43
 * @LastEditors: zhaoyu
 * @param:
 * @return:
 * @author: zhaoyu
 */

import React, { PureComponent } from "react";
export default class Index extends PureComponent {
  static getDerivedStateFromProps(nextProps, prevNext) {
    console.log("getDerivedStateFromProps", "---", nextProps, prevNext);
    return null;
  }

  static getSnapshotBeforeUpdate(props, state) {
    console.log("hello world");
    return "hello";
  }

  // 组件更新完毕的钩子
  componentDidUpdate(prevProps, prevState, snapshotValue) {
    console.log(prevProps, prevState, snapshotValue);
  }

  render() {
    const { count } = this.props;
    return <h1>new life : {count}</h1>;
  }
}
